{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\awant\\Anaconda3\\lib\\site-packages\\numpy\\lib\\arraysetops.py:522: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison\n",
      "  mask |= (ar1 == a)\n"
     ]
    }
   ],
   "source": [
    "visa_data = pd.read_csv('C:/Users/awant/workspace/video-course/machine-learning/Data/visa-status.csv', index_col='Unnamed: 0')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "Int64Index: 3002458 entries, 1 to 3002458\n",
      "Data columns (total 10 columns):\n",
      "CASE_STATUS           object\n",
      "EMPLOYER_NAME         object\n",
      "SOC_NAME              object\n",
      "JOB_TITLE             object\n",
      "FULL_TIME_POSITION    object\n",
      "PREVAILING_WAGE       float64\n",
      "YEAR                  float64\n",
      "WORKSITE              object\n",
      "lon                   float64\n",
      "lat                   float64\n",
      "dtypes: float64(4), object(6)\n",
      "memory usage: 252.0+ MB\n"
     ]
    }
   ],
   "source": [
    "visa_data.info()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "visa_data = visa_data.sample(5000)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "Int64Index: 5000 entries, 460292 to 920715\n",
      "Data columns (total 10 columns):\n",
      "CASE_STATUS           5000 non-null object\n",
      "EMPLOYER_NAME         5000 non-null object\n",
      "SOC_NAME              4976 non-null object\n",
      "JOB_TITLE             5000 non-null object\n",
      "FULL_TIME_POSITION    5000 non-null object\n",
      "PREVAILING_WAGE       5000 non-null float64\n",
      "YEAR                  5000 non-null float64\n",
      "WORKSITE              5000 non-null object\n",
      "lon                   4810 non-null float64\n",
      "lat                   4810 non-null float64\n",
      "dtypes: float64(4), object(6)\n",
      "memory usage: 429.7+ KB\n"
     ]
    }
   ],
   "source": [
    "visa_data.info()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>CASE_STATUS</th>\n",
       "      <th>EMPLOYER_NAME</th>\n",
       "      <th>SOC_NAME</th>\n",
       "      <th>JOB_TITLE</th>\n",
       "      <th>FULL_TIME_POSITION</th>\n",
       "      <th>PREVAILING_WAGE</th>\n",
       "      <th>YEAR</th>\n",
       "      <th>WORKSITE</th>\n",
       "      <th>lon</th>\n",
       "      <th>lat</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>460292</th>\n",
       "      <td>CERTIFIED</td>\n",
       "      <td>HCL AMERICA, INC.</td>\n",
       "      <td>COMPUTER OCCUPATIONS, ALL OTHER</td>\n",
       "      <td>TEST ANALYST - II</td>\n",
       "      <td>N</td>\n",
       "      <td>55682.0</td>\n",
       "      <td>2016.0</td>\n",
       "      <td>REDMOND, WASHINGTON</td>\n",
       "      <td>-122.121512</td>\n",
       "      <td>47.673988</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1529073</th>\n",
       "      <td>CERTIFIED</td>\n",
       "      <td>MITRA BIOTECH INC.</td>\n",
       "      <td>Biochemists and Biophysicists</td>\n",
       "      <td>SCIENTIST</td>\n",
       "      <td>Y</td>\n",
       "      <td>43950.0</td>\n",
       "      <td>2014.0</td>\n",
       "      <td>ZION, ILLINOIS</td>\n",
       "      <td>-87.832851</td>\n",
       "      <td>42.446132</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2252332</th>\n",
       "      <td>CERTIFIED</td>\n",
       "      <td>HCL AMERICA, INC.</td>\n",
       "      <td>Computer Systems Analysts</td>\n",
       "      <td>SYSTEMS ANALYST</td>\n",
       "      <td>Y</td>\n",
       "      <td>61526.0</td>\n",
       "      <td>2012.0</td>\n",
       "      <td>BEDMINSTER, NEW JERSEY</td>\n",
       "      <td>-74.680400</td>\n",
       "      <td>40.669264</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>907215</th>\n",
       "      <td>CERTIFIED</td>\n",
       "      <td>BOUNCE EXCHANGE INC.</td>\n",
       "      <td>SOFTWARE DEVELOPERS, SYSTEMS SOFTWARE</td>\n",
       "      <td>INTEGRATION SOFTWARE ENGINEER</td>\n",
       "      <td>Y</td>\n",
       "      <td>72384.0</td>\n",
       "      <td>2015.0</td>\n",
       "      <td>NEW YORK, NEW YORK</td>\n",
       "      <td>-74.005941</td>\n",
       "      <td>40.712784</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2847842</th>\n",
       "      <td>CERTIFIED</td>\n",
       "      <td>ENGINEERING TECHNOLOGY ASSOCIATES, INC.</td>\n",
       "      <td>Engineers, All Other</td>\n",
       "      <td>PROJECT ENGINEER</td>\n",
       "      <td>Y</td>\n",
       "      <td>65166.4</td>\n",
       "      <td>2011.0</td>\n",
       "      <td>SEATTLE, WASHINGTON</td>\n",
       "      <td>-122.332071</td>\n",
       "      <td>47.606209</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "        CASE_STATUS                            EMPLOYER_NAME  \\\n",
       "460292    CERTIFIED                        HCL AMERICA, INC.   \n",
       "1529073   CERTIFIED                       MITRA BIOTECH INC.   \n",
       "2252332   CERTIFIED                        HCL AMERICA, INC.   \n",
       "907215    CERTIFIED                     BOUNCE EXCHANGE INC.   \n",
       "2847842   CERTIFIED  ENGINEERING TECHNOLOGY ASSOCIATES, INC.   \n",
       "\n",
       "                                      SOC_NAME                      JOB_TITLE  \\\n",
       "460292         COMPUTER OCCUPATIONS, ALL OTHER              TEST ANALYST - II   \n",
       "1529073          Biochemists and Biophysicists                      SCIENTIST   \n",
       "2252332              Computer Systems Analysts                SYSTEMS ANALYST   \n",
       "907215   SOFTWARE DEVELOPERS, SYSTEMS SOFTWARE  INTEGRATION SOFTWARE ENGINEER   \n",
       "2847842                   Engineers, All Other               PROJECT ENGINEER   \n",
       "\n",
       "        FULL_TIME_POSITION  PREVAILING_WAGE    YEAR                WORKSITE  \\\n",
       "460292                   N          55682.0  2016.0     REDMOND, WASHINGTON   \n",
       "1529073                  Y          43950.0  2014.0          ZION, ILLINOIS   \n",
       "2252332                  Y          61526.0  2012.0  BEDMINSTER, NEW JERSEY   \n",
       "907215                   Y          72384.0  2015.0      NEW YORK, NEW YORK   \n",
       "2847842                  Y          65166.4  2011.0     SEATTLE, WASHINGTON   \n",
       "\n",
       "                lon        lat  \n",
       "460292  -122.121512  47.673988  \n",
       "1529073  -87.832851  42.446132  \n",
       "2252332  -74.680400  40.669264  \n",
       "907215   -74.005941  40.712784  \n",
       "2847842 -122.332071  47.606209  "
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "visa_data.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "feature_data = visa_data.drop(['CASE_STATUS'], axis=1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "target_data = visa_data.CASE_STATUS"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "cat_cols = list(feature_data.select_dtypes('object').columns)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['EMPLOYER_NAME', 'SOC_NAME', 'JOB_TITLE', 'FULL_TIME_POSITION', 'WORKSITE']"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "cat_cols"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [],
   "source": [
    "num_cols = list(feature_data.select_dtypes('float64').columns)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['PREVAILING_WAGE', 'YEAR', 'lon', 'lat']"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "num_cols"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
